package com.zzyl.elder.service.impl;

import java.util.List;
import com.zzyl.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zzyl.elder.mapper.BalanceMapper;
import com.zzyl.elder.domain.Balance;
import com.zzyl.elder.service.IBalanceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.Arrays;
/**
 * 余额Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-06-24
 */
@Service
public class BalanceServiceImpl extends ServiceImpl<BalanceMapper, Balance> implements IBalanceService
{
    @Autowired
    private BalanceMapper balanceMapper;

    /**
     * 查询余额
     * 
     * @param id 余额主键
     * @return 余额
     */
    @Override
    public Balance selectBalanceById(Long id)
    {
        return super.getById(id);
    }

    /**
     * 查询余额列表
     * 
     * @param balance 余额
     * @return 余额
     */
    @Override
    public List<Balance> selectBalanceList(Balance balance)
    {
        return balanceMapper.selectBalanceList(balance);
    }

    /**
     * 新增余额
     * 
     * @param balance 余额
     * @return 结果
     */
    @Override
    public int insertBalance(Balance balance)
    {
        balance.setCreateTime(DateUtils.getNowDate());
        return super.save(balance) ? 1 : 0;
    }

    /**
     * 修改余额
     * 
     * @param balance 余额
     * @return 结果
     */
    @Override
    public int updateBalance(Balance balance)
    {
        balance.setUpdateTime(DateUtils.getNowDate());
        return super.updateById(balance) ? 1 : 0;
    }

    /**
     * 批量删除余额
     * 
     * @param ids 需要删除的余额主键
     * @return 结果
     */
    @Override
    public int deleteBalanceByIds(Long[] ids)
    {
        return super.removeByIds(Arrays.asList(ids)) ? 1 : 0;
    }

    /**
     * 删除余额信息
     * 
     * @param id 余额主键
     * @return 结果
     */
    @Override
    public int deleteBalanceById(Long id)
    {
        return super.removeById(id) ? 1 : 0;
    }
}
